Skip to content

Conversation

@bparrish17
Copy link
Contributor

@bparrish17 bparrish17 commented Dec 18, 2025

Overview

  • Adds iosLocales to project YAML config
  • If iosLocales provided in conjunction with ios-strings or ios-stringsdict outputs, will write mapped variants to a <locale>.proj directory in the project YAML's outDir
  • Swift file will be generated that maps values to locale directories generated above
  • If variant configured in YAML but is NOT included as key in iosLocales, will write to output's outDir as usual

Context

DIT-12000: [CLI] Add iOSLocales Configuration

Test Plan

Config setup: Make sure to have iosLocales at the root of your project directory. Ideally you have a few variants in your local setup. If so, have at least a couple of them mapped to a locale, e.g. base: en, spanish: es

projects:
  - id: dittopay-v2-qa-file-bp-copy
  - id: cli-testing-project
variants:
  - id: base
  - id: spanish
  - id: japanese
components:
  folders:
    - id: root
iosLocales:
  - base: en
  - spanish: es
outputs:
  - format: ios-strings
    outDir: "./ditto/locale-testing/ios-strings"

  - format: ios-stringsdict
    outDir: "./ditto/locale-testing/ios-stringsdict"

This setup allowed me to ensure that spanish and english files were written to the project's outDir and not the individual output's outDir

  • Run yarn start pull, english and spanish variant files for both .strings and .stringsdict should be written to an en.lproj and es.lproj directory at the root of the project's outDir
  • A Ditto.swift file should be written to the root of the project's outDir. It should have actual swift code in it lol
  • Variants not configured in iosLocales should write to the output's outDir as expected

@bparrish17 bparrish17 changed the base branch from master to string-file-formats December 18, 2025 16:53
@bparrish17 bparrish17 marked this pull request as ready for review December 18, 2025 17:28
@bparrish17 bparrish17 requested a review from joustrich December 18, 2025 17:38
@bparrish17 bparrish17 requested review from JWhite30515 and removed request for joustrich December 19, 2025 14:50
@bparrish17 bparrish17 assigned JWhite30515 and unassigned joustrich Dec 19, 2025
@bparrish17 bparrish17 requested review from laurakoye and removed request for JWhite30515 December 19, 2025 19:24
@bparrish17 bparrish17 assigned laurakoye and unassigned JWhite30515 Dec 19, 2025
Copy link

@laurakoye laurakoye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't encounter any issues testing. I know you wanted to get another review, so I'll just leave my comments.

Copy link

@laurakoye laurakoye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found what I think is an issue:
https://www.loom.com/share/d619af17b17d4f7f95991f894ed2600c

If I have a variant applied to a text item the generated string and string dics are showing the base text. This is true even if the variant has plurals on it.

@bparrish17 bparrish17 requested a review from laurakoye January 7, 2026 14:16
@bparrish17 bparrish17 merged commit 0eb8896 into string-file-formats Jan 7, 2026
1 check passed
bparrish17 added a commit that referenced this pull request Jan 8, 2026
* [DIT-11970] iOS Strings Format Support (#129)

* Add scaffolding for ios-strings support, notably IOSStringsFormatter class, and IOSStringsOutput file

* Add /v2/variants endpoint. Update IOSStringsFormatter to pull down variants and projects as expected. Moved shared BaseFormatter class methods out of JSON and IOSStringsFormatters

* Minor inline doc updates

* Add pull command E2E tests for outputted ios-strings files. Added component mapping to iosStringsFormatter

* Add unit tests to IOSSTringsFormatter class

* Update variant fetching to be shared across textItems and components. Unit tests additions to IOSStringsFormatter class

* Update http request tests to handle default error

* Minor: test fix

* Minor: cleanup and .gitignore of local items

* [DIT-11792][DIT-11791][DIT-11960] IOS Strings Dict, Android, ICU format additions (#130)

* Add ios-stringsdict support to BaseFormatter

* Refactor IOSStringsFileFormatter into BaseExportFormatter to be shared amongst all export formats. Updated IOSStringsDict to use that class

* Add android export format

* Add BaseExportFormatter class tests. Updated IOSStringsFormatter tests to no longer include baseExport method tests. Updated all formats to test for correct output file creation

* Update base generateQueryParams to take in filters as sole param

* Add i18n test cases

* Add ios-stringsdict and Android XML formatting tests to pull

* Add ICU format. Update HTTP Response types to allow for JSON. Added generics to BaseFormatter to allow for parameter-ized response types

* Updated ExportComponentsResponse and TextItemsResponse Zod schema

* Made BaseExportFormatter abstract class

* Minor: clean

* Test fix and HTTP wrapper cleanup

* Minor: clean

* Add promise.all to fetchTextItemsMap and fetchComponentsMap for performance

* [DIT-12000] Add iosLocales Configuration Support (#132)

* Add iosLocale to config and file generation

* Add new fetch request for swift file from API

* Add Swift file generation logic to baseexport class

* clean for PR

* Add test cases to ios methods on baseExport class

* Minor: clean

* minor: remove unused type

* minor: remove test script

* update pull params for export endpoints

* Update all instances of 'icu' to be 'json_icu'

* Address initial PR comments

* Add swift file generation to root of pull command. Address some cleanup review comments

* Fix pull command tests for iosLocales

* Move generateSwiftFile tests to util file

* Minor clean

* Remove console log and fix test data

* Add test case for empty iosLocalese array

* Minor name clarification

* Fix format default case, missing promise.all, and typing issue

* Added ios-specific getLocalesPath method to those classes, along with tests

* Fix issue where ___<variant_id> suffixed files were getting written to iosLocale directories

* Split up textItems and components HTTP calls for export vs default

* Replaced all instances of 'base' with BASE_VARIANT_ID const in lib/src directory. Removed now-unnecessary type params from Formatter classes

* Fix text item text status duplicates from merge. Bump version minor

* Fix status filter merge issue

* Fix to base variant not getting included in variants (id: all). minor cleanup of statuses qp

* Add fetchVariants tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants